<?php

class SalesOrderProduct extends Eloquent {

	 protected $table = 'sales_order_product';

	/**
	 * Condition: Unarchived Items.
	 * @author AngelaMisa 03/28/2015 3:30AM
	 * @param $query
	 * @return mixed
	 */
	public function scopeActive( $query ) {
		return $query->where($this->table . '.archived', 0);
	}
	
	/**
	 * Relates to Sales Order.
	 * @author AngelaMisa 03/28/2015 3:30AM
	 * @return mixed
	 */
	public function salesOrder() {
		return $this->belongsTo('SalesOrder', 'SALES_ORDER_id');
	}
	
	/**
	 * Relates to Order Product.
	 * @author AngelaMisa 03/28/2015 3:30AM
	 * @return mixed
	 */
	public function order() {
		return $this->belongsTo('OrderProduct', 'ORDER_PRODUCT_id');
	}
}